<template>
	<view>
		<view class="xm-flex-c xm-justify-center xm-align-content-center xm-brr-20rpx"
			style="background-color: #FFFFFF;width: 100%;height: auto;align-items: center;padding: 30rpx;">
			<view class=""
				style="width: 157rpx;height: 157rpx;border-radius: 157rpx;background-color: #19caff;margin-top: 158rpx;margin-bottom: 30rpx;">
				<image src="https://img0.baidu.com/it/u=19766716,3349517949&fm=26&fmt=auto" mode="widthFix"
					style="width: 157rpx;border-radius: 157rpx;"></image>
			</view>

			<input type="text" value="" placeholder="点击输入账号" v-model="user.user"
				style="margin-top: 30rpx;margin-bottom: 30rpx;width: 80%;border: 4rpx #4CD964 solid;padding: 15rpx;border-radius: 20rpx;padding-left: 20rpx;" />

			<input type="text" value="" placeholder="点击输入密码" v-model="user.password"
				style="margin-bottom: 30rpx;width: 80%;border: 4rpx #4CD964 solid;padding: 15rpx;border-radius: 20rpx;padding-left: 20rpx;" />

			<view class="xm-but" hover-class="but-selct" @click="login()"
				style="text-align: center;width: 70%;height: 70rpx;line-height: 70rpx;border-radius: 20rpx;margin-top: 60rpx;color: #FFFFFF;">
				登录
			</view>

			<view class="xm-flex-r xm-justify-between"
				style="align-items: center;width: 90%;margin-top: 30rpx;margin-bottom: 300rpx;">
				<view class="xm-fontsize-15" style="color: #555555;">
					找回密码
				</view>
				<view class="xm-fontsize-15" style="color: #555555;" @click="topage('to','../rig/rig')">
					注册用户
				</view>
			</view>
		</view>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				user: {
					user: "",
					password: ""
				}
			}
		},
		methods: {
			login() {
				this.$http("http://127.0.0.1:4399/user/login", "post", this.user, {
					'content-type': 'application/json'
				}).then(res=>{
					// console.log(res);
					// console.log(res.msg);
					this.$api.msg(res.msg)
					uni.setStorage({
						key:"token",
						data:res.data.id
					})
					this.$api.gotoType('back')
				})
			},
			topage(type,url){
			this.$api.gotoType(type,url)	
			}
			
		}
	}
</script>

<style>
	page {
		background-color: #C0C0C0;
		box-sizing: border-box;
		padding: 30rpx;
	}

	.xm-but {
		background: linear-gradient(to right, #26acd4, #d6d6d6);
	}
</style>
